import com.sun.xml.internal.bind.v2.model.core.ID;

import java.util.HashMap;
import java.util.List;

/**
 * 哈希环（一致性哈希门面）
 * @author xhf
 */
public class HashRing {
    IDistribution distribution;

    HashRing(List<Node> nodes) {
        distribution = new SimpleDistribution();
        new HashRing(distribution, nodes);
    }

    HashRing(IDistribution distribution, List<Node> nodes) {
        this.distribution = distribution;
        this.distribution.addNodes(nodes);
    }

    public void addNodes(List<Node> nodes) {
        this.distribution.addNodes(nodes);
    }

    public void removeNodes(List<Node> nodes) {
        this.distribution.removeNodes(nodes);
    }

    public void search(String key) {
        this.distribution.search(key);
    }

}
